Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
The "original" argument must be of type function. Received an instance of Object

I used to have this:

const util = require('util');
const exec = util.promisify(require('child_process').exec);

Then I refactored to this (or at least my attempt to here):

import * as exec from 'child_process';
const execPromise = util.promisify(exec);

Now I am getting the error TypeError: The "original" argument must be of type function. Received an instance of Object on the exec in util.promisify

Not sure how to quite get this working like it was but with this new import syntax for Typescript (specifically related to `@typescript-eslint/no-var-requires

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You're looking for

import { exec } from 'child_process';
const execPromise = util.promisify(exec);

The * as exec did import the whole child_process module into a module namespace object.

about 4 years ago · Santiago Trujillo Report

0

Try this...

import * as childProcess from 'child_process';
const execPromise = util.promisify(childProcess.exec);
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!